package com.gujia.designpattern;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class PrintHandler implements InvocationHandler{

    private  Object target;

    public PrintHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("----------before------------");
        method.invoke(target);
        System.out.println("----------after-------------");
        return null;
    }
}
